home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / texts / mpindx50.lha / MPIndex50Src.lha / sc / sprintf.c
C/C++ Source or Header  |  1995-07-05  |  1KB  |  38 lines

  1. /* mpaddock@cix.compulink.co.uk */
  2. /* mark@topic.demon.co.uk */
  3.  
  4. /* sprintf() using RawDoFmt() */
  5.  
  6. #define __USE_SYSBASE 1
  7. #ifdef __GNUC__
  8. #include <inline/exec.h>
  9. #else
  10. #include <proto/exec.h>
  11. #endif
  12. #include <stdarg.h>
  13. /*#include <stdio.h> */
  14.  
  15. int sprintf(char *buffer,char *ctl, ...)
  16. {
  17.    va_list args;
  18.  
  19.    va_start(args, ctl);
  20.  
  21.    /*********************************************************/
  22.    /* NOTE: The string below is actually CODE that copies a */
  23.    /*       value from d0 to A3 and increments A3:          */
  24.    /*                                                       */
  25.    /*          move.b d0,(a3)+                              */
  26.    /*          rts                                          */
  27.    /*                                                       */
  28.    /*       It is essentially the callback routine needed   */
  29.    /*       by RawDoFmt.                                    */
  30.    /*********************************************************/
  31.  
  32.    RawDoFmt(ctl, args, (void (*))"\x16\xc0\x4e\x75", buffer);
  33.  
  34.    va_end(args);
  35.  
  36.    return 0;
  37. }
  38.